<template>
  <div class="password">
    <el-dialog
      title="文章受保护，请输入访问密码"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
    >
      <el-input
        placeholder="请输入密码"
        v-model="inp"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="confirm "
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { mapState, mapActions, mapMutations } from "vuex";
export default {
  data() {
    return {
      dialogVisible: true,
      inp: "",
    };
  },
  computed: {
    ...mapState({
      archivesListId: (state) => state.archives.archivesListId,
    }),
  },
  methods: {
    handleClose(done) {
      console.log(done);
      // this.$confirm("确认关闭？")
      //   .then((_) => {
      //     done();
      //   })
      //   .catch((_) => {});
      this.$router.push('/')
    },
    //确认
    confirm(){
      console.log(this.archivesListId);
      //关闭弹框
      this.dialogVisible=false; 
    },
    //取消
    cancel(){
      this.$router.push('/');
    }
  },
};
</script>

<style></style>
